﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.IsolatedStorage;

class IsolatedStorage
{
    static void Main()
    {
        IsolatedStorageFile userStorage = IsolatedStorageFile.GetUserStoreForAssembly();
        using (userStorage)
        {
            IsolatedStorageFileStream myStream = new IsolatedStorageFileStream("myIsolatedStorage.txt", 
                                            FileMode.OpenOrCreate, userStorage);
            using (myStream)
            {
                string dateAndTime;
                TextReader reader = new StreamReader(myStream);
                dateAndTime = reader.ReadToEnd();
                if (dateAndTime != null && dateAndTime != "")
                {
                    Console.WriteLine(dateAndTime);
                }
                myStream.SetLength(0);
                TextWriter writer = new StreamWriter(myStream);
                using (writer)
                {
                    writer.Write("Last start at: {0}", DateTime.Now.ToString());
                }
            }
        }

    }
}

